package org.csmzxy.class2333;

public class 第一题 {

    public static void main(String[] args){
        int arr[] = {1,3,5,7};
        int maxValue = findMaxValue(arr);
        System.out.println("最大值为："+maxValue);
    }
    public static int findMaxValue(int[]arr){
        if (arr == null || arr.length == 0){
            try {
                throw new IllegalAccessException("数组不能为空");
            } catch (IllegalAccessException e) {
                e.printStackTrace();
            }
        }
        int max = arr[0];
        for (int i=1; i< arr.length;i++){
            if (arr[i]>max){
                max = arr[i];
            }
        }
        return max;
    }
}